<?php

declare (strict_types=1);

namespace App\Common\Modular\Data\Model;

use Core\Basics\BasicsModel;
use Zms\HyperfCasts\StrtotimeCasts;

/**
 * @property int $id
 * @property string $name 文件名
 * @property int $is_show 资源库
 * @property int $cate_id 分类
 * @property string $drive 驱动类型
 * @property string $key 文件哈希
 * @property int $size 文件大小
 * @property string $type 文件类型
 * @property string $format 文件格式
 * @property string $url 引用地址
 * @property string $path 储存位置
 * @property string $source 来源
 * @property int $user_id 上传人
 * @property int $merchant_id 商户
 * @property int $time 上传时间
 */
class ResourceModel extends BasicsModel
{
    const CREATED_AT = 'time';
    const UPDATED_AT = null;

    /**
     * The table associated with the model.
     *
     * @var null|string
     */
    protected ?string $table = 'data_resources';
    /**
     * The attributes that are mass assignable.
     *
     * @var array
     */
    protected array $fillable = [];
    /**
     * The attributes that should be cast to native types.
     *
     * @var array
     */
    protected array $casts = [
        'id' => 'int',
        'cate_id' => 'integer',
        'is_show' => 'integer',
        'size' => 'integer',
        'user_id' => 'integer',
        'merchant_id' => 'integer',
        'time' => StrtotimeCasts::class
    ];
}
